package expressoes;

import java.util.HashMap;

public class And extends Binaria {

	public And(Expressao a, Expressao b) {
		exp1 = a;
		exp2 = b;
		operador = ".";
	}

	@Override
	public String calcula(HashMap<String, String> hash) {
		
		String r = "";
		
		if(!hash.containsKey(exp1.getExpressao())){
			r = exp1.calcula(hash);
		} else {
			r = hash.get(exp1.getExpressao());
		}
		
		if(r.equals("1")){
			if(!hash.containsKey(exp1.getExpressao())){
				r = exp1.calcula(hash);
			} else {
				r = hash.get(exp1.getExpressao());
			}
		}
		
		return r;
	}

}
